﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WorldSource.GUI
{
    public class GUIHandler
    {
        public List<GUIObject> GUIComponents = new List<GUIObject>();
        public GUIHandler()
        {
            GUI.Button btn = new GUI.Button("Press me!", Game1.game.Content.Load<Texture2D>("button"));
            btn.area = new Rectangle(0, 0, 81, 50);
            btn.onClicked += new GUIObject.ClickedHandler(btn_onClicked);
            GUIComponents.Add(btn);
        }

        void btn_onClicked(object sender)
        {
            Game1.game.Exit();
        }

        void btn_ButtonMouseLeave(object sender)
        {Game1.game.Exit();
        }

        void btn_ButtonMouseEnter(object sender)
        {
            
        }

        public void Update()
        {
            foreach (GUIObject guiObj in GUIComponents)
                guiObj.Update();
        }

        public void Draw()
        {
            foreach (GUIObject guiObj in GUIComponents)
                guiObj.Draw();
        }

        void btn_ButtonClicked(object sender)
        {
            Game1.game.Exit();
        }
    }
}
